import { h } from "koishi"

export const name = "at-nop-hint"

export function apply(ctx) {
  ctx.on("ready", () => {
    ctx.platform("onebot").middleware(async (session, next) => {
      if (h.select(session.elements, "at").some(e => e.attrs.id === session.selfId))
        return await next(() => {
          session.onebot._request("group_poke", {
            group_id: session.channelId,
            user_id: session.userId,
          })
        })
      return next()
    })
  })
}
